import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class code1 {
    //血量+攻击力
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        while ( t-- != 0) {
            int h = in.nextInt();//血
            int a = in.nextInt();//攻击力
            int H = in.nextInt();
            int A = in.nextInt();

            int _H = H;

            int ret = 0;
            if (a >= H) {
                System.out.println(-1);
            } else {
                while (h > 0) {
                    H -= a;
                    if (H <= 0) {
                        ret++;
                        H = _H;
                    } else {
                        h -= A;
                    }
                }
                System.out.println(ret);
            }


        }
    }
}